import request from "@/utils/request";
import type { LoginResponse, GetUserInfoResponse } from "./model/loginModel";

enum Api {
  loginUrl = "/admin/acl/index/login",
  logoutUrl = "/admin/acl/index/logout",
  getUserInfoUrl = "/admin/acl/index/info",
}

// 登录
export const loginApi = (username: string, password: string) => {
  return request.post<any, LoginResponse>(Api.loginUrl, { username, password });
};

// 获取用户数据
export const getUserInfoApi = () => {
  return request.get<any, GetUserInfoResponse>(Api.getUserInfoUrl);
};

// 退出登录
export const loguotApi = () => {
  return request.post<any, null>(Api.logoutUrl);
};
